package com.sk.order.config;

import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.loadbalancer.annotation.LoadBalancerClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;
//配置我们自定义的负载均衡策略
@LoadBalancerClient(name = "product-service",configuration = CustomLoadBalancerConfiguration.class)

@Configuration
public class BeanConfig {

    //服务端实现负载均衡
    //1. 加上 @LoadBalanced 注解
    @LoadBalanced
    @Bean
    public RestTemplate restTemplate(){
        return new RestTemplate();
    }
}
